package com.wwwzh.himalayafm.fragment;


import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.wwwzh.himalayafm.R;
import com.wwwzh.himalayafm.fragment.subfragment.SubViewPagerAdapter;

/**
 * A simple {@link Fragment} subclass.
 * 订阅听碎片
 */
public class SubFragment extends Fragment {
    private ViewPager subViewPager;

    public SubFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
    {
      View   rootView = paramLayoutInflater.inflate(R.layout.fragment_sub, paramViewGroup, false);
        this.subViewPager = ((ViewPager)rootView.findViewById(R.id.Sub_VP));

       SubViewPagerAdapter subViewPagerAdapter = new SubViewPagerAdapter(getChildFragmentManager());
        this.subViewPager.setAdapter(subViewPagerAdapter);
        ((TabLayout)rootView.findViewById(R.id.subtab_TL)).setupWithViewPager(this.subViewPager);
        return rootView;
    }
    public ViewPager getSubViewPager()
    {
        return this.subViewPager;
    }
}
